]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st: Create shadow pipeline taking resource scale in account
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Mon, 25 Feb 2019 14:42:51 +0000 (15:42 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Fri, 1 Mar 2019 17:12:52 +0000 (17:12 +0000)
The shadow pipeline is created doing software blurring of the texture so the
shadow spec blur parameter should be scaled accordingly with the texture scaling
otherwise we won't take enough pixels in account creating stronger shadows.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5

src/st/st-private.c
src/st/st-private.h
src/st/st-theme-node-drawing.c

index a74368709cfdefe3bedf7a115bb7806d4c3f3f76..895e33b1e2c82d26513a3c29c58a6d3de09ab69c 100644 (file)
@@ -359,7 +359,8 @@ blur_pixels (guchar  *pixels_in,
 
 CoglPipeline *
 _st_create_shadow_pipeline (StShadow    *shadow_spec,
-                            CoglTexture *src_texture)
+                            CoglTexture *src_texture,
+                            float        resource_scale)
 {
   ClutterBackend *backend = clutter_get_default_backend ();
   CoglContext *ctx = clutter_backend_get_cogl_context (backend);
@@ -386,7 +387,7 @@ _st_create_shadow_pipeline (StShadow    *shadow_spec,
                          rowstride_in, pixels_in);
 
   pixels_out = blur_pixels (pixels_in, width_in, height_in, rowstride_in,
-                            shadow_spec->blur,
+                            shadow_spec->blur * resource_scale,
                             &width_out, &height_out, &rowstride_out);
   g_free (pixels_in);
 
@@ -456,7 +457,8 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
       if (texture &&
           cogl_texture_get_width (texture) == width &&
           cogl_texture_get_height (texture) == height)
-        shadow_pipeline = _st_create_shadow_pipeline (shadow_spec, texture);
+        shadow_pipeline = _st_create_shadow_pipeline (shadow_spec, texture,
+                                                      resource_scale);
     }
 
   if (shadow_pipeline == NULL)
@@ -510,7 +512,8 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
 
       cogl_object_unref (fb);
 
-      shadow_pipeline = _st_create_shadow_pipeline (shadow_spec, buffer);
+      shadow_pipeline = _st_create_shadow_pipeline (shadow_spec, buffer,
+                                                    resource_scale);
 
       cogl_object_unref (buffer);
     }
index f88f93009477f014e05f56704639df7fbf38c9c6..0f3cb2f2c6b708e3313beab2464326f527865c7b 100644 (file)
@@ -63,7 +63,8 @@ CoglPipeline * _st_create_texture_pipeline (CoglTexture *src_texture);
 
 /* Helper for widgets which need to draw additional shadows */
 CoglPipeline * _st_create_shadow_pipeline (StShadow    *shadow_spec,
-                                           CoglTexture *src_texture);
+                                           CoglTexture *src_texture,
+                                           float        resource_scale);
 CoglPipeline * _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
                                                       ClutterActor *actor);
 cairo_pattern_t *_st_create_shadow_cairo_pattern (StShadow        *shadow_spec,
index 7db928a0d75dc3ea2af60ed4d7e25c489bd6c2b6..3aaba3424e61d13fa5b80f892591bf8e1d02cd55 100644 (file)
@@ -1422,7 +1422,8 @@ st_theme_node_load_background_image (StThemeNode *node)
       if (background_image_shadow_spec)
         {
           node->background_shadow_pipeline = _st_create_shadow_pipeline (background_image_shadow_spec,
-                                                                         node->background_texture);
+                                                                         node->background_texture,
+                                                                         resource_scale);
         }
     }
 
@@ -1561,10 +1562,12 @@ st_theme_node_render_resources (StThemeNodePaintState *state,
     {
       if (st_theme_node_load_border_image (node))
         state->box_shadow_pipeline = _st_create_shadow_pipeline (box_shadow_spec,
-                                                                 node->border_slices_texture);
+                                                                 node->border_slices_texture,
+                                                                 state->resource_scale);
       else if (state->prerendered_texture != NULL)
         state->box_shadow_pipeline = _st_create_shadow_pipeline (box_shadow_spec,
-                                                                 state->prerendered_texture);
+                                                                 state->prerendered_texture,
+                                                                 state->resource_scale);
       else if (node->background_color.alpha > 0 || has_border)
         st_theme_node_prerender_shadow (state);
     }
@@ -1636,7 +1639,8 @@ st_theme_node_update_resources (StThemeNodePaintState *state,
 
   if (had_box_shadow)
     state->box_shadow_pipeline = _st_create_shadow_pipeline (box_shadow_spec,
-                                                             state->prerendered_texture);
+                                                             state->prerendered_texture,
+                                                             state->resource_scale);
 }
 
 static void
@@ -2330,7 +2334,7 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state)
       st_theme_node_paint_borders (state, offscreen, &box, 0xFF);
 
       state->box_shadow_pipeline = _st_create_shadow_pipeline (st_theme_node_get_box_shadow (node),
-                                                               buffer);
+                                                               buffer, state->resource_scale);
     }
   else
     {